package android.zhcs.mb;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    public static void satart(Context context){
        Intent intent = new Intent(context,MainActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ViewPager2 viewPager2 = findViewById(R.id.banner);
        viewPager2.setAdapter(new FragmentStateAdapter() {
            @NonNull
            @org.jetbrains.annotations.NotNull
            @Override
            public Fragment createFragment(int position) {
                return new dra(position);
            }

            @Override
            public int getItemCount() {
                return 3;
            }
        });
    }
}